//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Silla.h"

//---------------------------------------------------------------------------

#pragma package(smart_init)
Silla::Silla(float alA, float lA, float anA, float gA, float alR,float rP){
        alturaAsiento=alA;
        largoAsiento=lA;
        anchoAsiento=anA;
        grosorAsiento=gA;
        alturaRespaldo=alR;
        radioPata=rP;        
        float anchoTablerosRespaldo=1;

        traslada(0,alturaAsiento,0);

        Tablero *asiento,*resp1, *resp2, *resp3, *resp4;

        asiento=new Tablero(largoAsiento,anchoAsiento, grosorAsiento, largoAsiento, anchoAsiento, 3);
        anadeParte(asiento);
        asiento->setColor(1.0,0.0,0.0);

        Cilindro* pata1=new Cilindro(radioPata,radioPata/2, alturaAsiento,10,5);
        anadeParte(pata1);
        pata1->setColor(0.6,0.2,0.0);
        pata1->traslada(largoAsiento - radioPata,0,radioPata);
        pata1->rota(90,1,0,0);

        Cilindro* pata2=new Cilindro(radioPata,radioPata/2, alturaAsiento,10,5);
        anadeParte(pata2);
        pata2->setColor(0.6,0.2,0.0);
        pata2->traslada(radioPata,0,radioPata);
        pata2->rota(90,1,0,0);

        Cilindro* pata3=new Cilindro(radioPata,radioPata/2, alturaAsiento,10,5);
        anadeParte(pata3);
        pata3->setColor(0.6,0.2,0.0);
        pata3->traslada(radioPata,0,anchoAsiento - radioPata);
        pata3->rota(90,1,0,0);

        Cilindro* pata4=new Cilindro(radioPata,radioPata/2, alturaAsiento,10,5);
        anadeParte(pata4);
        pata4->setColor(0.6,0.2,0.0);
        pata4->traslada(largoAsiento - radioPata,0,anchoAsiento - radioPata);
        pata4->rota(90,1,0,0);

        resp1=new Tablero(anchoTablerosRespaldo,anchoTablerosRespaldo, alturaRespaldo,3,3, alturaRespaldo);
        resp1->setColor(0.6,0.2,0.0);
        resp1->traslada(0,grosorAsiento,0);
        anadeParte(resp1);

        resp2=new Tablero(anchoTablerosRespaldo,anchoTablerosRespaldo, alturaRespaldo,3,3, alturaRespaldo);
        resp2->setColor(0.6,0.2,0.0);
        resp2->traslada(largoAsiento-anchoTablerosRespaldo,grosorAsiento,0);
        anadeParte(resp2);

        resp4=new Tablero(2*anchoTablerosRespaldo,anchoTablerosRespaldo, alturaRespaldo,6,6, alturaRespaldo);
        resp4->setColor(0.6,0.2,0.0);
        resp4->traslada(largoAsiento/2-anchoTablerosRespaldo,grosorAsiento,0);
        anadeParte(resp4);

        resp3=new Tablero(largoAsiento,anchoTablerosRespaldo,anchoTablerosRespaldo ,largoAsiento,3,3);
        resp3->setColor(0.6,0.2,0.0);
        resp3->traslada(0,alturaRespaldo+grosorAsiento,0);
        anadeParte(resp3);
}


